package objects.visualization;

import base.Graphics;
import objects.DataObject;

public class TextBlock extends Block {
	int indent;
	String text;

	public TextBlock( DataObject object, String text, int indent ) {
		this.object = object;
		this.indent = indent;
		this.text = text;
	}
	
	public TextBlock( DataObject object, String text ) {
		this( object, text, 0 );
	}
	
	@Override
	public void draw( int drawingX, int drawingY ) {
		super.draw( drawingX, drawingY );
		Graphics.drawText( text, drawingX + x + defaultMargin * indent, drawingY + y );
	}
	
	@Override
	public void update() {
		width = Graphics.currentFont.getWidth( text ) + defaultMargin * indent;
		height = Graphics.currentFont.getLineHeight();
	}
}